package com.yw.atp.service;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.yw.atp.model.Profession;


@Repository
@Transactional
public class ProfessionService{
	@PersistenceContext
    private EntityManager em;
	public List<Profession> getProfessions(Profession pro){
		Query query = em.createQuery("select p FROM  Profession p where p.name like :proName and p.status !='1' order by p.id desc");
		query.setParameter("proName","%"+pro.getName()+"%");
		return (List<Profession>)query.getResultList();
	}
}
